﻿
using SqlSugar;

namespace DataAcquisitionDAL
{
    /// <summary>
    /// 试压工程
    ///</summary>
    [SugarTable("d_project")]
    public class ProjectModel
    {
        /// <summary>
        /// 备  注:ID
        /// 默认值:
        ///</summary>
        [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
        public int ID { get; set; }

        /// <summary>
        /// 备  注:工程编号
        /// 默认值:
        ///</summary>
        [SugarColumn(ColumnName = "number", IsPrimaryKey = true)]
        public string Number { get; set; } = null!;

        /// <summary>
        /// 备  注:工程名称
        /// 默认值:
        ///</summary>
        [SugarColumn(ColumnName = "name")]
        public string Name { get; set; } = null!;

        /// <summary>
        /// 备  注:工程桩号
        /// 默认值:
        ///</summary>
        [SugarColumn(ColumnName = "stake_mark")]
        public string StakeMark { get; set; } = null!;

        /// <summary>
        /// 备  注:管材规格
        /// 默认值:
        ///</summary>
        [SugarColumn(ColumnName = "pipe_specification")]
        public string PipeSpecification { get; set; } = null!;

        /// <summary>
        /// 备  注:管道长度
        /// 默认值:
        ///</summary>
        [SugarColumn(ColumnName = "pipe_length")]
        public double PipeLength { get; set; }

        /// <summary>
        /// 备  注:试压介质
        /// 默认值:
        ///</summary>
        [SugarColumn(ColumnName = "medium")]
        public string Medium { get; set; } = null!;

        /// <summary>
        /// 备  注:设计压力
        /// 默认值:
        ///</summary>
        [SugarColumn(ColumnName = "design_pressure")]
        public double DesignPressure { get; set; }

        /// <summary>
        /// 备  注:管道性质
        /// 默认值:
        ///</summary>
        [SugarColumn(ColumnName = "pipe_nature")]
        public string PipeNature { get; set; } = null!;

        /// <summary>
        /// 备  注:试压类型
        /// 默认值:
        ///</summary>
        [SugarColumn(ColumnName = "test_type")]
        public string TestType { get; set; } = null!;

        /// <summary>
        /// 备  注:施工单位
        /// 默认值:
        ///</summary>
        [SugarColumn(ColumnName = "company")]
        public string Company { get; set; } = null!;

        /// <summary>
        /// 备  注:压力表精度
        /// 默认值:
        ///</summary>
        [SugarColumn(ColumnName = "manometer_precision")]
        public string ManometerPrecision { get; set; } = null!;

        /// <summary>
        /// 备  注:压力表量程
        /// 默认值:
        ///</summary>
        [SugarColumn(ColumnName = "manometer_range")]
        public string ManometerRange { get; set; } = null!;

        /// <summary>
        /// 备  注:试压模板ID
        /// 默认值:
        ///</summary>
        [SugarColumn(ColumnName = "template_id")]
        public int TemplateID { get; set; }

        /// <summary>
        /// 根据工程编号判断是否存在
        /// </summary>
        /// <param name="number"></param>
        /// <returns></returns>
        public static bool RecordExistenceWithNumber(string number)
        {
            Dictionary<string, Object> where = new Dictionary<string, Object>();
            where["number"] = number;
            List<ProjectModel> list = SqlSugarHelper.Inquireable<ProjectModel>(where);
            if (list.Count > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
